Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added RPM package generation and upload #37

Merged
merged 8 commits into from
Feb 26, 2017
Merged

Conversation

BClark09
Copy link
Member

@BClark09 BClark09 commented Feb 17, 2017

Requires testing to confirm the following before merge:

  • Automatic uploads in separate RPM specific repo
  • openHAB installs correctly using the Repository Installation Paths
  • openHAB upgrades correctly, preserving configurations files if changed by the user.
  • Upgrades only occur when a new version of the RPM package is released
  • Works the same on Fedora, CentOS and Red Hat
  • Does not change the functionality of the .Deb packages
  • Test addons and legacy-addons install

To help test, please use the following /etc/yum.repos.d/openHAB.repo

[openHAB]
name=openHAB
baseurl=https://openhab.jfrog.io/openhab/linuxpkg-testing-rpm/
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://openhab.jfrog.io/openhab/api/gpg/key/public

install with:

yum install openhab2
yum install openhab2-addons
yum install openhab2-addons-legacy

Closes #36

Signed-off-by: Ben Clark ben@benjyc.uk

@Stormwind99
Copy link

Stormwind99 commented Feb 17, 2017

Error on Fedora 24:

[root@linus opt]# dnf install openhab2
Last metadata expiration check: 0:00:28 ago on Fri Feb 17 14:50:12 2017.
Error: nothing provides adduser needed by openhab2-2.1.0.20170217150518-1.noarch
(try to add '--allowerasing' to command line to replace conflicting packages)
[root@linus opt]# dnf install --allowerasing openhab2
Last metadata expiration check: 0:02:27 ago on Fri Feb 17 14:50:12 2017.
Error: nothing provides adduser needed by openhab2-2.1.0.20170217150518-1.noarch

adduser exists on the system, provided by shadow-utils package:

[root@linus opt]# which adduser
/usr/sbin/adduser
[root@linus opt]# rpm -q -f /usr/sbin/adduser
shadow-utils-4.2.1-8.fc24.i686

In https://github.com/openhab/openhab-linuxpkg/pull/37/files I see:

requires('adduser')

One way to fix might be (though might not be right for non-RH/Fedora/CentOS distros, I'm unsure):

if (pType == 'Rpm') {
requires('shadow-utils')
} else {
requires('adduser')
}

I don't know if gradle exposes this at the build.gradle level, but Fedora packaging guidelines use Requires(pre): shadow-utils and useradd:
https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Dynamic_allocation

@BClark09
Copy link
Member Author

Hmm, even getting passed that the openhab user doesn't exist because there's no RPM based addgroup. Bare with me for a bit.

@BClark09
Copy link
Member Author

image

The latest version seems to work for testing.

@theoweiss
Copy link
Member

@BClark09 I did the rpm packaging some weeks ago for a project at work. I've used the packaging of elasticsearch as template:
You will need to add more deb/rpm specific handling into the script files as you can see here:
https://github.com/elastic/elasticsearch/tree/master/distribution/src/main/packaging/scripts
I suggest to stick with addgroup and adduser for debian like the elasticsearch guys did.

The script files are called with a different set of arguments depending if the executor is rpm or deb. Therefore you can distinguish between rpm and deb installations.

@Stormwind99
Copy link

The yum repo packages still give me the adduser error - guessing the rpm in the repo has not been updated yet?

@BClark09
Copy link
Member Author

BClark09 commented Feb 18, 2017

Hmm, what happens when you

dnf clean all
dnf update

?

@sipvoip
Copy link

sipvoip commented Feb 18, 2017

Just a cosmetic thing, but you want way to rename it to openHAB rather then openHABRepo. Only issue I ran into was a LOT of warnings like:

warning: user openhab does not exist - using root
warning: group openhab does not exist - using root

Should not the .spec file create the user if it does not exist? Also, should think about signing the rpms.

Was not able to install addons:

Transaction check error:
file /usr/share/openhab2 from install of openhab2-addons-0:2.1.0.20170218132317-1.noarch conflicts with file from package openhab2-0:2.1.0.20170218132317-1.noarch

Also some errors with remove:

Running transaction
Erasing : openhab2-2.1.0.20170218132317-1.noarch 1/1
postrm called with unknown argument `0'
warning: %postun(openhab2-0:2.1.0.20170218132317-1.noarch) scriptlet failed, exit status 1
Non-fatal POSTUN scriptlet failure in rpm package openhab2-2.1.0.20170218132317-1.noarch
Verifying : openhab2-2.1.0.20170218132317-1.noarch 1/1

Removed:
openhab2.noarch 0:2.1.0.20170218132317-1

Complete!

@BClark09
Copy link
Member Author

Thanks for testing both, this is really helpful!

Just a cosmetic thing, but you want way to rename it to openHAB rather then openHABRepo

Good point! Will change that when I come to writing it up in docs.

warning: user openhab does not exist - using root
warning: group openhab does not exist - using root

Right, I see that RPM and APT use different terms for [pre/post][inst/rm] and was trying to use the same ones. I've submitted another package to the repo to address this. Does this fix all the known errors (besides not being able to install addons)?

Also, should think about signing the rpms.

They will be signed with the same GPG key as the Deb files are when testing is complete.

@BClark09
Copy link
Member Author

@theoweiss Have just seen your comment, sorry. Now that the basics are working I will follow the same style as you have showed.

@Stormwind99
Copy link

@BClark09 - dnf clean worked, but repos don't normally require that step to find newer packages.

The following worked and installled openhab2-2.1.0.20170218221203-1.noarch.rpm:

dnf clean
dnf install --nogpgcheck openhab2

@Stormwind99
Copy link

Error on installing openhab2-addons:

Error: Transaction check error:
  file /usr/share/openhab2 from install of openhab2-addons-0:2.1.0.20170218221203-1.noarch conflicts with file from package openhab2-0:2.1.0.20170218221203-1.noarch

Signed-off-by: Ben Clark <ben@benjyc.uk>
Signed-off-by: Ben Clark <ben@benjyc.uk>
Signed-off-by: Ben Clark <ben@benjyc.uk>
@BClark09
Copy link
Member Author

Hi @Stormwind99 and @sipvoip. I have completed the work on the rpm packages, and all known issues are resolved. Would you be able to test them for me? To do so you'll need to first

yum remove openhab2
yum update
yum install openhab2
yum install openhab2-addons

if you want to simulate an upgrade, then you can pick the other version (has the same rpm setup as the latest) on the repo, simply by running the command:

yum install openhab2-2.1.0.20170225003526

Please let me know how you get on, I have tested a new install and upgrade of all packages on Fedora 25, but would like confirmation before I start moving to a full repo with GPG signing.

Signed-off-by: Ben Clark <ben@benjyc.uk>
@BClark09
Copy link
Member Author

@theoweiss, assuming that others are able to confirm my tests would you be happy for this PR (based on this diff to be merged?

@Stormwind99
Copy link

Stormwind99 commented Feb 25, 2017

Both packages installed without error for me in Fedora 24:

dnf remove openhab2
dnf update
dnf install --nogpgcheck openhab2
dnf install --nogpgcheck openhab2-addons

@sipvoip
Copy link

sipvoip commented Feb 25, 2017 via email

Copy link
Member

@theoweiss theoweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Some documentation would be fine, see my comments.

@@ -56,8 +56,8 @@ waitForStopFinished(){
}

case "$1" in
configure)
if [ -z $2 ] ; then
configure|1|2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment with doc about what 1|2 args mean.

;;
remove|deconfigure)
remove|deconfigure|0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment with doc about the 0 arg.

removeCache
exit 0
;;
0) # RPM has no purge, assume remove does this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment with doc about 0 arg.

Signed-off-by: Ben Clark <ben@benjyc.uk>
Signed-off-by: Ben Clark <ben@benjyc.uk>
@BClark09
Copy link
Member Author

Thanks @Stormwind99 and @sipvoip for testing! And thanks @theoweiss for reviewing, I've added the documentation now so will merge and test a gpg signed version!

@BClark09 BClark09 merged commit be9ca42 into openhab:master Feb 26, 2017
@BClark09 BClark09 deleted the add-rpm branch February 26, 2017 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants